package com.dayaokeji.rhythmschoolstudent.client.mine.bulletin;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import com.dayaokeji.rhythmschoolstudent.R;
import com.dayaokeji.rhythmschoolstudent.utils.BulletinUtil;
import com.dayaokeji.rhythmschoolstudent.utils.DateUtils;
import com.dayaokeji.server_api.domain.Bulletin;

/**
 * Created by Gorden on 2017/9/29.
 */

public class BulletinAdapter extends BaseQuickAdapter<Bulletin,BaseViewHolder>{

    public BulletinAdapter() {
        super(R.layout.item_notice_list, null);
    }

    @Override
    protected void convert(BaseViewHolder helper, Bulletin item) {
        helper.addOnClickListener(R.id.tv_receipt);

        helper.setText(R.id.tv_title,item.getTitle());
        helper.setText(R.id.tv_content,item.getInform());
        helper.setText(R.id.tv_time, DateUtils.format(item.getTime(),DateUtils.FORMAT_DATETIME_SHORT2));

        helper.getView(R.id.tv_receipt).setVisibility(item.getRevert() == BulletinUtil.NEED_RECEIPT ? View.VISIBLE : View.GONE);
        helper.getView(R.id.tv_receipt).setEnabled(item.getStatus() == BulletinUtil.NO_RECEIPT ? true : false );
        helper.setText(R.id.tv_receipt,item.getStatus() == BulletinUtil.NO_RECEIPT ? "未查看" : "已查看" );
    }
}
